import os.path

from selenium import webdriver
from selenium.webdriver.common.by import By
import time

# 准备配置项
options = webdriver.ChromeOptions()
# 准备下载路径
down = os.path.dirname(os.path.abspath(__file__)) + '/down'
prefs = {
    'profile.default_content_settings.popups': 0,
    'download.default_directory': down
}
options.add_experimental_option('prefs', prefs)

# 打开浏览器(设置options),请求测试网址
driver = webdriver.Chrome(options=options)
driver.get('https://www.selenium.dev/downloads/')

# 定位下载文件
driver.find_element(By.LINK_TEXT, 'CHANGELOG').click()
